﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:waf="http://waf.codeplex.com/schemas"
    xmlns:c="clr-namespace:Waf.BookLibrary.Library.Presentation.Converters">

    <SolidColorBrush x:Key="InvalidControlBrush" Color="#E5B8B7"/>


    <Style TargetType="Label">
        <Setter Property="Margin" Value="11,11,0,0"/>
    </Style>

    <Style TargetType="Button">
        <Setter Property="MinWidth" Value="75"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="Margin" Value="11,11,0,0"/>
    </Style>
    
    <Style TargetType="TextBox">
        <Setter Property="MinHeight" Value="25"/>
        <Setter Property="MinWidth" Value="100"/>
        <Setter Property="Margin" Value="11,11,0,0"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate/> <!-- Set an empty error template, hide the red rectangle -->
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="Background" Value="{StaticResource InvalidControlBrush}"/>
                <Setter Property="ToolTip">
                    <Setter.Value>
                        <MultiBinding Converter="{StaticResource ValidationErrorsConverter}">
                            <Binding Path="(Validation.Errors)" RelativeSource="{RelativeSource Self}"/>
                            <Binding Path="(Validation.Errors).Count" RelativeSource="{RelativeSource Self}"/>
                        </MultiBinding>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="DatePicker">
        <Setter Property="MinHeight" Value="25"/>
        <Setter Property="MinWidth" Value="100"/>
        <Setter Property="Margin" Value="11,11,0,0"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>

    <Style TargetType="ComboBox">
        <Setter Property="Margin" Value="11,11,0,0"/>
    </Style>
    
    <Style TargetType="RadioButton">
        <Setter Property="Margin" Value="11,11,0,0"/>
    </Style>
    
    <Style TargetType="DataGrid">
        <Setter Property="AutoGenerateColumns" Value="False"/>
        <Setter Property="CanUserAddRows" Value="False"/>
        <Setter Property="CanUserReorderColumns" Value="False"/>
        <Setter Property="HeadersVisibility" Value="Column"/>
        <Setter Property="HorizontalGridLinesBrush" Value="LightGray"/>
        <Setter Property="VerticalGridLinesBrush" Value="LightGray"/>
    </Style>

    <Style x:Key="TextCellElementStyle" TargetType="TextBlock">
        <Setter Property="Padding" Value="4,2,4,3"/>
    </Style>

    <Style x:Key="TextCellEditingStyle" TargetType="TextBox">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Padding" Value="2,2,2,3"/>
    </Style>

    <Style TargetType="MenuItem">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="False">
                <Setter Property="Opacity" Value="0.6"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Static ToolBar.ButtonStyleKey}" TargetType="{x:Type Button}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="False">
                <Setter Property="Opacity" Value="0.35"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="HeaderLabel" TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
        <Setter Property="FontWeight" Value="SemiBold"/>
    </Style>

</ResourceDictionary>